<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%-- 此区域根据用户是否登录，显示不同的内容 --%>
<c:if test="${user==null }">
	<div class="block">
		<h3>Login</h3>
		<p><span class="error_info">${loginMsg }</span></p>
		<s:form action="LoginAction_login" namespace="/user" method="post">
			<p>用户名：<s:textfield name="userName" size="15"/></p>
			<p>密码：&nbsp;&nbsp;&nbsp;<s:password name="password" size="15"/></p>
			<p><input type="submit" value="登录" class="btn"/>
			<a href="user/user_register">注册用户</a></p>
		</s:form>
	</div>
</c:if>

<!-- 标签区域 -->
<div class="block">
	<h3>Tags</h3>
	<s:iterator value="#request.labels" var="item">
		<s:set value="item" var="lname"></s:set>
		<span><a href="tag/tag_query?key=<s:property value='%{@java.net.URLEncoder@encode(#lname,"utf-8")}'/>">
		${item }</a><span>&nbsp;&nbsp;&nbsp;
	</s:iterator>
</div>

<div class="block">
	<h3>Report</h3>
	<marquee scrollAmount="1" width="160" height="160" direction="up" onmouseover="top()" onmouseout="start()">
		<s:iterator value="#request.recentRecordViews" var="recentRecordView">
			<p>
				<s:property value="recentRecordView.inDate"/>
				<s:property value="#recentRecordView.inDate.substring(0,16)"/>
				<a href="page/user/user_info.jsp?userID=${recentRecordView.userID }">
				<s:set var="userID" value="userID"></s:set>
				<s:property value="%{@cn.sdut.training.utils.ConvertUtils@convertUserIDtoUserName(#userID)}"/>
				</a>上传了<a href="${recentRecordView.ojUrl }" target="_blank">${recentRecordView.ojName }</a>&nbsp;上的&nbsp;
				<a href="user/code_read?recordID=${recordID }">${recentRecordView.problemID }（${recentRecordView.problemTitle }）</a>&nbsp;
			</p>
		</s:iterator>
	</marquee>
</div>

<div class="block">
	<h3>Links</h3>
	<ul>
		<li><a href="#" title="欢迎进入山东理工大学在线评测系统" target="_blank">[山东理工ACM]</a></li>
		<li><a href="#" target="_blank">[杭电ACM]</a></li>
		<li><a href="#" target="_blank">[PKUOJ]</a></li>
		<li><a href="#" target="_blank">[PKU百练]</a></li>
	</ul>
</div>
